﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace Tmp.Models;

public class FileUpload
{
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }
    public string? Hash { get; set; }
    private string? FilePathsJson { get; set; }

    [NotMapped]
    public List<string> FilePaths
    {
        get => JsonConvert.DeserializeObject<List<string>>(FilePathsJson);
        set => FilePathsJson = JsonConvert.SerializeObject(value);
    }
}